package com.microinvest.util;

import java.util.regex.Pattern;

//此工具类用于判断用户是否输入正确邮箱格式
public class Validator {
    // 定义邮箱的正则表达式
    private static final String EMAIL_REGEX = "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$";

    public static boolean isValidEmail(String email) {
        return Pattern.matches(EMAIL_REGEX, email); // 匹配正则表达式
    }


    //验证密码格式
    public static boolean validateNewPassword(String password) {
        return password.length() >= 8 && password.matches(".*[A-Z].*") &&
                password.matches(".*[a-z].*") && password.matches(".*\\d.*") && password.matches(".*[@#$%^&+=].*");
    }


}
